package org.tau.workshop2011.semantics

import org.tau.workshop2011.expressions.Type
import org.tau.workshop2011.parsing.AST

case class DuplicateDefineException (vari:String) extends Exception ("The variable " + vari + " was defined twice")

case class UseBeforeDefineException (vari:String) extends Exception ("The local variable " + vari + " is used but never defined!")

case class ConflictingTypesException (expr:AST.Expr, newType:Type)
  extends Exception ("Conflicting types for " + expr + "." +
        " Previous type was " + expr.resultType + " but now tried to assign the" +
        "type " + newType)

case class DifferentTypesComparisionException (expr1:AST.Expr,expr2:AST.Expr)
  extends Exception ("Comparision between different types! " +
    "Can not compare between " + expr1.resultType + " and " + expr2.resultType +
    "(tried comparing the expressions " + expr1 + " and " + expr2 + ")")